/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FarmacieDAL;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "MEDICAMENT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Medicament.findAll", query = "SELECT m FROM Medicament m"),
    @NamedQuery(name = "Medicament.findByIdMedicament", query = "SELECT m FROM Medicament m WHERE m.idMedicament = :idMedicament"),
    @NamedQuery(name = "Medicament.findByMedicament", query = "SELECT m FROM Medicament m WHERE m.medicament = :medicament"),
    @NamedQuery(name = "Medicament.findByCost", query = "SELECT m FROM Medicament m WHERE m.cost = :cost")})
public class Medicament implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_MEDICAMENT")
    private Integer idMedicament;
    @Column(name = "MEDICAMENT")
    private String medicament;
    @Column(name = "COST")
    private BigInteger cost;
    @OneToMany(mappedBy = "idMedicament")
    private Collection<Arhiva> arhivaCollection;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "idMedicament")
    private Stocuri stocuri;
    @JoinColumn(name = "ID_SUBSTANTA_ACTIVA", referencedColumnName = "ID_SUBSTANTA_ACTIVA")
    @ManyToOne
    private SubstantaActiva idSubstantaActiva;
    @JoinColumn(name = "ID_PRODUCATOR", referencedColumnName = "ID_PRODUCATOR")
    @ManyToOne
    private Producatori idProducator;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idMedicament")
    private Collection<Vanzari> vanzariCollection;

    public Medicament() {
    }

    public Medicament(Integer idMedicament) {
        this.idMedicament = idMedicament;
    }

    public Integer getIdMedicament() {
        return idMedicament;
    }

    public void setIdMedicament(Integer idMedicament) {
        this.idMedicament = idMedicament;
    }

    public String getMedicament() {
        return medicament;
    }

    public void setMedicament(String medicament) {
        this.medicament = medicament;
    }

    public BigInteger getCost() {
        return cost;
    }

    public void setCost(BigInteger cost) {
        this.cost = cost;
    }

    @XmlTransient
    public Collection<Arhiva> getArhivaCollection() {
        return arhivaCollection;
    }

    public void setArhivaCollection(Collection<Arhiva> arhivaCollection) {
        this.arhivaCollection = arhivaCollection;
    }

    public Stocuri getStocuri() {
        return stocuri;
    }

    public void setStocuri(Stocuri stocuri) {
        this.stocuri = stocuri;
    }

    public SubstantaActiva getIdSubstantaActiva() {
        return idSubstantaActiva;
    }

    public void setIdSubstantaActiva(SubstantaActiva idSubstantaActiva) {
        this.idSubstantaActiva = idSubstantaActiva;
    }

    public Producatori getIdProducator() {
        return idProducator;
    }

    public void setIdProducator(Producatori idProducator) {
        this.idProducator = idProducator;
    }

    @XmlTransient
    public Collection<Vanzari> getVanzariCollection() {
        return vanzariCollection;
    }

    public void setVanzariCollection(Collection<Vanzari> vanzariCollection) {
        this.vanzariCollection = vanzariCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMedicament != null ? idMedicament.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Medicament)) {
            return false;
        }
        Medicament other = (Medicament) object;
        if ((this.idMedicament == null && other.idMedicament != null) || (this.idMedicament != null && !this.idMedicament.equals(other.idMedicament))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "FarmacieDAL.Medicament[ idMedicament=" + idMedicament + " ]";
    }
    
}
